package com.example.config;


import com.example.common.properties.AliOSSProperties;
import com.example.common.utils.AliOSSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class OssConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public AliOSSUtils aliOSSUtils(AliOSSProperties aliOSSProperties) {
        log.info("开始创建阿里云文件上传工具类对象：{}",aliOSSProperties);
        log.info("文件上传配置信息：{}",aliOSSProperties);
        return new AliOSSUtils(aliOSSProperties.getEndpoint(),aliOSSProperties.getBucketName());
    }
}
